export default {
    namespaced: true,
    state: {
        list: [
            {id:1,uname:"吃饭",isDone:true},
            {id:2,uname:"睡觉",isDone:false},
            {id:3,uname:"打豆豆",isDone:true},    
        ]
    },
    mutations: {
         // 增
         addList(state,value){
            state.list.push({
                id:state.length+1,
                uname:value,
                isDone:false
            })
        },
        // 删
        removeList(state,id){
            state.list=state.list.filter(item=>{
                return item.id!==id
            })
        },
        // 清除已完成
        removeAll(state){
            state.list=state.list.filter(item=>{
                return item.isDone===false
            })
        },
        // 已完成
        complete(state){
            state.list=state.list.filter(item=>{
                return item.isDone===true
            })
        },
        // 未完成
        uncomplete(state){
            state.list=state.list.filter(item=>{
                return item.isDone===false
            })
        }
    },
    actions: {
    },
}